package com.se.service;

import com.se.dao.mysql.CatDao;
import com.se.domain.mysql.CategoryDO;
import com.se.domain.vo.CatVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class CatService {
    @Autowired
    CatDao catDao;

    public List<CatVO> listAllCat() {
        List<CategoryDO> catDOList = catDao.listAll();
        List<CatVO> voList = new ArrayList<>();
        for (CategoryDO categoryDO : catDOList) {
            voList.add(new CatVO(categoryDO));
        }
        return voList;
    }
}
